{extend name="main/index" /}
{block name="main"}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">Home</a>
            </li>

            <li>
                <a href="{:url('admin/material/index')}" >Tables</a>
            </li>
            <li class="active">详情信息</li>
        </ul><!-- .breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                    <i class="icon-search nav-search-icon"></i>
                </span>
            </form>
        </div><!-- #nav-search -->
    </div>
    <div class="page-content">
        <div class="row">
        <div class="col-xs-2">
        </div>
            <div class="col-xs-8">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-responsive">
                            <form id="themeForm" method="post"  onsumbit ="return false" enctype="multipart/form-data" >
                                <div class="form-group">
                                    <label for="exampleInputEmail1">项目名称</label>
                                    <!-- <?php var_dump($list)?> -->
                                    <input type="hidden" class="form-control" id="exampleInputEmail1" name="id" value= "{$list['id']}" >
                                    <input type="text" class="form-control" id="exampleInputEmail1" value= "{$list['project_name']}" name="project_name" readonly>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">机械名称</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="machine_name" placeholder="Email" value="{$list['machine_name']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">运费</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="freight" placeholder="Email" value="{$list['freight']}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">维修费</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="maintenance_cost" placeholder="Email" value="{$list['maintenance_cost']}" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">油费</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="oil_cost" placeholder="oil_cost" value="{$list['oil_cost']}" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">机械使用费</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="machine_usage_cost" placeholder="Password" value="{$list['machine_usage_cost']}" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">总计</label>
                                    <input type="text" class="form-control" id="exampleInputPassword1" name="total_price" placeholder="Password" value="{$list['total_price']}" >
                                </div>
                                  <div class="form-group">
                                  <button  class="btn btn-info up_btn" id="add_Material" >确认更改</button>
                                      <div class="col-xs-8">
                                      </div>

                                      <!--<a href="{:url('admin/mechanical/mechanical_details',['id' => $list['id']])}" class="btn btn-info" id="aa" >返回上一级</a>-->

                                </div>
                            </form>
                        </div>
            </div>
            <div class="col-xs-3">
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
</div>




{/block}

        {block name="myjs"}
        <script>
            $('#add_Material').click(function(){
                id= $('input[name="id"]').val();
                upAjax(id);
            });

            function upAjax(id){
                $.ajax({
                    type:'post',
                    url: '/admin/Mechanical/updateCost/id/'+ id,
                    dataType:'json',
                    data: {
                        id:$('input[name="id"]').val(),
                        machine_name:$('input[name="machine_name"]').val(),
                        freight:$('input[name="freight"]').val(),
                        maintenance_cost:$('input[name="maintenance_cost"]').val(),

                        oil_cost:$('input[name="oil_cost"]').val(),

                        machine_usage_cost:$('input[name="machine_usage_cost"]').val(),
                        total_price:$('input[name="total_price"]').val()
                    },

                    success: function (data) {
                        console.log(data);
                        if (data.status) {
                            alert('成功');
                        } else {
                            alert('失败');
//                            toastr.error(data.info, 'FBI WARNING:');
                        }
                    },

                    error: function () {
                        alert('AJAX执行失败');
                    }
                });
            }

        </script>

        {/block}
